package com.wlxy.springbootdemo.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wlxy.springbootdemo.mapper.WorkSheetMapper;
import com.wlxy.springbootdemo.model.WorkSheet;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author thinkpad
 */
@Service
public class WorkSheetServiceImpl implements WorkSheetService {

    @Resource
    private WorkSheetMapper workSheetMapper;

    /**
     * 查询
     *
     * @param sheetID
     * @return
     */
    @Override
    public List<WorkSheet> selectWorkSheet(String sheetID) {
        QueryWrapper<WorkSheet> queryWrapper = new QueryWrapper<>();
        queryWrapper.ge("sheetId", sheetID);
        return workSheetMapper.selectList(queryWrapper);
    }

    /**
     * 添加
     *
     * @param workSheet
     * @return
     */
    @Override
    public int insertWorkSheet(WorkSheet workSheet) {
        return workSheetMapper.insert(workSheet);
    }

    /**
     * 删除
     *
     * @param sheetID
     * @return
     */
    @Override
    public int deleteWorkSheet(String sheetID) {
        QueryWrapper<WorkSheet> queryWrapper = new QueryWrapper<>();
        queryWrapper.ge("sheetId", sheetID);
        return workSheetMapper.delete(queryWrapper);
    }
}
